package com.lovo.service;

import com.lovo.model.InvoiceDO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Service
public class InvoiceService {
    private List invoiceList = new ArrayList();
    @Resource
    private UserService userService;

    public List findAll(){
        return invoiceList;
    }
    public void create(String userId,int amount){
        if(userService.findById(userId) == null){
            return;
        }
        InvoiceDO invoiceDO = new InvoiceDO(userId,amount,"http://www.lovo.com/invoice.pdf");
        invoiceList.add(invoiceDO);
        System.out.println("invoiceDO"+invoiceDO);
    }
}
